<%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<script type="text/javascript">
	$(function() {
		var infoContainet = $("#deptinfo_box").empty();
		$.post($.webapp.root + "/admin/system/deptinfo_category/getCategoryByDept.do", {"deptid" : "${USER_SESSION.user.org_id}"}, function(result) {
			
			if(result.length > 0) {
				$.each(result, function(i, item) { 
					var d1 = $("<div></div>").addClass("deptinfo_container").appendTo(infoContainet) ;
					var h3 = $("<h3></h3>").addClass("title").appendTo(d1) ;
					var h3_sp0 = $("<span></span>").attr("id", "title").html(item.name).appendTo(h3) ;
					var h3_sp1 = $("<span></span>").attr("id", "more").html("更多").appendTo(h3) ;
					//var h3_sp2 = $("<span></span>").attr("id", "ref_icon").appendTo(h3) ;
					var list_box = $("<div></div>").addClass("list1").appendTo(d1) ;
					var ul = $("<ul></ul>").appendTo(list_box) ;
					
					h3_sp1.click(function() {
						window.mainpage.addModuleTab({
							title: $(this).siblings("#title").text(),
							iniframe: true,
							href: $.webapp.root + "/admin/system/deptinfo_item/deptinfo_view_by_category_UI.do?id="+item.id
						});
						
					});
					
					$.post($.webapp.root + "/admin/system/deptinfo_item/view_datagrid.do", {"categoryId" : item.id, rows: 5,sort: "created", order: "desc"}, function(list) {
						$.each(list.rows, function(i, item) {
							var li = $("<li></li>").appendTo(ul);
							li.html('<div><span>'+item.createName+'</span><a href="'+$.webapp.root+'/admin/system/deptinfo_item/deptinfo_open_UI.do?id='+item.id+'" target="_blank">'+item.subject+'</a></div>') ;
						});
					});
				});
			} else {
				infoContainet.html('<div style="width: 80%;margin:0 auto;text-align: center;">没有数据...</div>') ;
			}

		}, 'json');
	});
	
</script>
<div id="deptinfo_box">
	
</div>